import { request } from "@/utils/request";
import { mockUrlPrefix } from "@/api/baseUrl";

export function queryApi(params) {
  return request({
    url: `${mockUrlPrefix}/api/system/table/list`,
    params,
  });
}

export function createApi(data) {
  return request({
    url: `${mockUrlPrefix}/api/system/table`,
    method: "post",
    data,
  });
}

export function updateApi(data) {
  return request({
    url: `${mockUrlPrefix}/api/system/table`,
    method: "put",
    data,
  });
}

export function deleteApi(data) {
  return request({
    url: `${mockUrlPrefix}/api/system/table`,
    method: "delete",
    data: {
      id: data,
    },
  });
}

export function detailApi(params) {
  return request({
    url: `${mockUrlPrefix}/api/system/table/detail`,
    method: "get",
    params
  });
}

export function getTableConfigByType(type) {
  return request({
    url: `${mockUrlPrefix}/api/system/table/detail?tableValue=${type}`,
    method: "get",
  });
}